package com.whz.eq;

import com.google.common.base.Objects;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;

/**
 * @Author: sinosoft
 * @Description: 不可变的二维整数型Point
 * @Date: Create in 16:49 2021/4/30
 * @Modified By:
 */
@Slf4j
public class Point {
    private final int x;
    private final int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public boolean equals(Object o) {
        log.info("Point.o.getClass() : {}", o.getClass());
        if (!(o instanceof Point)) {
            log.info("Point.o instanceof Point");
            return false;
        }
        Point point = (Point) o;
        return new EqualsBuilder().append(x, point.x).append(y, point.y).isEquals();
    }

}
